﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net.Sockets;

namespace ggprot
{
    public class GGUserData : GGHeader
    {
        private int type;
        private int num;
        private GGUserDataUser[] users;

        public GGUserDataUser[] Users
        {
            get { return users; }
            set { users = value; }
        }

        public int Num
        {
            get { return num; }
            set { num = value; }
        }

        public int Type1
        {
            get { return type; }
            set { type = value; }
        }

        public GGUserData(GGHeader Base)
        {
            this.Type = Base.Type;
            this.Length = Base.Length;
        }

        public override void Read(NetworkStream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            this.type = reader.ReadInt32();
            this.num = reader.ReadInt32();
            users = new GGUserDataUser[num];

            for (int i = 0; i < num; i++)
            {
                GGUserDataUser usr = new GGUserDataUser();
                usr.Read(stream);

                users[i] = usr;
            }
        }
    }
}
